1. Field of the Invention
The present invention relates to an apparatus and a method for controlling an operation of acquiring a snapshot of a database built on an external storage of a computer system.
2. Background Art
In operating a database, a mismatch can occur between contents of the database because of a bug in an application that uses the database, an operational error of an operation, or the like. In general, a fault as described above is called a logic fault. In the case of a logic fault, since a database management system (hereinafter referred to as a DBMS) has properly completed the process according to the input, the fault can not be detected by a fault detecting function of the DBMS. A logic fault as described above is detected by database users such as a system manager or operator.
When a logic fault as described above has occurred, a manager or operator must identify the point in time when the logic fault occurred and restore the contents of the database up to a point in time which precedes the identified time of occurrence of the fault and at which data has consistency.
When it is stated that data has consistency, what is meant is that the data has been updated in conformity to an operation log recorded in an operation log file managed by a DBMS. A common DBMS reserves a buffer area for temporarily saving the contents of an update on a cache memory of the host computer on which the DBMS is operating, or the like. Even when an operator or the like makes a data update, the contents of the update is not immediately reflected on a data file and is held in the buffer area. In order to bring about a state in which data has consistency, the contents of all updates held on the buffer area must be reflected on the data file that is held in a storage or the like. Since the DBMS assumes that a fault has occurred in the data file when there is no consistency of data, the data file cannot be opened.
In order to restore the contents of the database up to a point in time when the data has consistency, a snapshot must be acquired in advance in a state in which data has consistency. For this purpose, it is necessary to staticize the database and acquire a snapshot thereof in a state in which data has consistency. Snapshot is to maintain data to be snapshot at a certain point in time in an external storage, and it is a function provided by most storage systems.
Staticizing a database is to stop a process of updating a data file in the database. Unless the database is staticized, since an update process may be performed on data to be snapshot, data consistency is lost and, even if the snapshot is acquired, it will be data which cannot be used for data recovery.
In a nonstop-operated database system in which a database is accessed 24 hours, it is difficult to staticize the database. For this reason, some DBMS provide a function to staticize a database virtually while executing access to a data file (hereinafter referred to as a virtual database staticizing function). However, since the virtual database staticizing function is executed by a DBMS, it increases the load on the host computer on which the DBMS operates. Further, since database stacisization must be executed until data snapshot is completed, it is very much difficult to use it in a large-scale database or environment under a heavy load when influences on regular tasks are taken into consideration.
As a method for solving to the above-described problems, a method is under study, in which a DBMS cooperates with software operating on a host computer or an external storage to reduce the load on the host computer at the time of data snapshot as much as possible.
A typical approach is to staticize a virtual database using a virtual database staticizing function of a DBMS and to create a snapshot of a file or logical volume which is to be snapshot at the point in time when the database is staticized. When the creation of the snapshot is completed, the virtual database staticization is canceled, and the DBMS returns to a normal operation. Next, backup software or the like is used to make a copy of the snapshot in a backup device.
A snapshot can be created by using an LVM (Logical Volume Manager) of an OS, software provided by various vendors, or a snapshot creating function provided by an external storage.
When a snapshot is to be acquired by an automatic operation utilizing an application such as scheduling software according to this method, the application must request the DBMS to staticize the database to put the database in a consistent state, at a time when a snapshot is to be acquired, and it must create a snapshot while the database is staticized.
When the LVM or software is used, the LVM or software must have means for requesting a DBMS to staticize a database. The DBMS is also required to have the database staticizing function or an application interface which allows database staticization to be executed according to a request from an external application. This places a limit on software and DBMSs that can be used or necessitates modifications of software or DBMS.
Further, since the LVM and software operate on a host computer, loads are placed on the host computer not only when a snapshot is created but also by management of the snapshot or the like.
In order to mitigate the above-described problems, methods for acquiring a snapshot having consistency without placing an unduly heavy load on a host computer are under study. For example, a method may be employed in which a snapshot function provided by some external storages is used. In this case, a host computer requests an external storage to create a snapshot through an interface provided by the external storage; the external storage creates a snapshot upon receipt of the request; and the management of the snapshot is thus conducted by the external storage. As a result, the host computer is freed from loads other than a load associated with the issue of the snapshot creation request.
The use of a snapshot acquired according to the above method makes it possible to restore consistent data when a logic fault or the like has occurred. This schematically illustrated in FIG. 1. First, as shown in FIG. 1, data in which a logic fault has occurred is restored to the snapshot data that is closest to the time of occurrence of the fault among snapshots acquired before the occurrence of the logic faults. Next, data updates which have been made to the data until immediately before the occurrence of the logic fault are re-executed (hereinafter referred to as roll forward). The roll forward is a function which is provided by a common DBMS.
According to the above-described method, in general, a system manager or a program or batch job operating on a host computer requests a DBMS to staticisize the database, and the system manager or the like issues a snapshot creation request to an external memory while the database is staticized. When the creation of a snapshot is completed, the system manager or the like cancels the database staticization and acquires the snapshot. The database staticization is executed by the DBMS. Therefore, a load is placed on the host computer on which the DBMS operates when the database is staticized.
The above-described method makes it possible to restore data having consistency before the occurrence of a logic fault.
However, in a nonstop-operated database system, since a reduction in processing performance attributable to a virtual database staticizing process performed for each snapshot can be a problem, it is necessary to acquire snapshots by selecting a time zone in which the host computer has a relatively light load or to keep the frequency of the database staticizing process as low as possible. Such a restriction reduces the number of points at which a logic fault can be recovered. When the number of points where recovery is enabled is reduced, a problem arises in that a long time is required to execute a roll forward process from the data of a snapshot until a state immediately before the occurrence of a logic fault.
Further, since the database staticizing process may involve a separate interface for each DBMS and some DBMS may not have required functions, it is difficult to manage backup and restoration in an environment where various platforms exist.